<template>
	<div class="mainCont">
		<div class="leftCont">
			<ul class="snav"
				v-if="$permissions.indexOf(70) != -1||$permissions.indexOf(73) != -1||$permissions.indexOf(76) != -1||$permissions.indexOf(79) != -1||$permissions.indexOf(93) != -1||$permissions.indexOf(276) != -1">
				<li>
					<a href="#" @click="down1=!down1">组织架构<span class="iconfont icon-up"
							:style="down1?'transform: rotateZ(180deg);':'transform: rotateZ(0deg);'"></span> </a>
					<div class="down" v-if="down1">

						<router-link to="/department" v-if="$route.name=='department' && permissions.indexOf(70)  != -1"
							@click.native="flushCom" :class="$route.name=='department'?'active':''">部门管理</router-link>
						<router-link to="/department" v-if="$route.name!='department' && permissions.indexOf(70)  != -1"
							:class="$route.name=='department'?'active':''">部门管理
						</router-link>



						<router-link to="/userlist" v-if="$route.name=='userlist' && permissions.indexOf(73)  != -1"
							@click.native="flushCom" :class="$route.name=='userlist'?'active':''">用户管理</router-link>
						<router-link to="/userlist" v-if="$route.name!='userlist' && permissions.indexOf(73)  != -1"
							:class="$route.name=='userlist'?'active':''">用户管理
						</router-link>


						<router-link to="/group" v-if="$route.name=='group' && permissions.indexOf(76)  != -1"
							@click.native="flushCom" :class="$route.name=='group'?'active':''">分组管理</router-link>
						<router-link to="/group" v-if="$route.name!='group' && permissions.indexOf(76)  != -1"
							:class="$route.name=='group'?'active':''">分组管理</router-link>

						<router-link to="/engineer" v-if="$route.name=='engineer' && permissions.indexOf(79)  != -1"
							@click.native="flushCom" :class="$route.name=='engineer'?'active':''">工程师管理</router-link>
						<router-link to="/engineer" v-if="$route.name!='engineer' && permissions.indexOf(79)  != -1"
							:class="$route.name=='engineer'?'active':''">工程师管理
						</router-link>

						<router-link to="/permissions"
							v-if="$route.name=='permissions' && permissions.indexOf(93)  != -1" @click.native="flushCom"
							:class="$route.name=='permissions'?'active':''">权限管理</router-link>
						<router-link to="/permissions"
							v-if="$route.name!='permissions' && permissions.indexOf(93)  != -1"
							:class="$route.name=='permissions'?'active':''">权限管理
						</router-link>

						<router-link to="/subsystem" v-if="$route.name=='subsystem' && permissions.indexOf(276)  != -1"
							@click.native="flushCom" :class="$route.name=='subsystem'?'active':''">子系统管理</router-link>
						<router-link to="/subsystem" v-if="$route.name!='subsystem' && permissions.indexOf(276)  != -1"
							:class="$route.name=='subsystem'?'active':''">子系统管理
						</router-link>
					</div>
				</li>
			</ul>
			<!-- 配置页面新增的授权管理与日志清理页面  wcf  12.15 ------------------------------------------------------------>
			 <!-- v-if="uname == 'admin'" -->
			<ul class="snav">
				<li>
					<a href="#" @click="down2=!down2">系统设置<span class="iconfont icon-up"
							:style="down2?'transform: rotateZ(180deg);':'transform: rotateZ(0deg);'"></span> </a>
					<div class="down" v-if="down2">
						<router-link to="/setting" v-if="$route.name=='setting' && permissions.indexOf(279)  != -1"
							@click.native="flushCom" :class="$route.name=='setting'?'active':''">授权管理</router-link>
						<router-link to="/setting" v-if="$route.name!='setting' && permissions.indexOf(279)  != -1"
							:class="$route.name=='setting'?'active':''">授权管理</router-link>

						<router-link to="/clearjour" v-if="$route.name=='clearjour' && permissions.indexOf(280)  != -1"
							@click.native="flushCom" :class="$route.name=='clearjour'?'active':''">日志清理</router-link>
						<router-link to="/clearjour" v-if="$route.name!='clearjour' && permissions.indexOf(280)  != -1"
							:class="$route.name=='clearjour'?'active':''">日志清理
						</router-link>

					<!-- 	<router-link to="/three" v-if="$route.name=='three' && permissions.indexOf(282)  != -1"
							@click.native="flushCom" :class="$route.name=='three'?'active':''">第三方配置</router-link>
						<router-link to="/three" v-if="$route.name!='three' && permissions.indexOf(282)  != -1"
							:class="$route.name=='three'?'active':''">第三方配置
						</router-link>
 -->
						<router-link to="/phone" v-if="$route.name=='phone' && permissions.indexOf(285)  != -1"
							@click.native="flushCom" :class="$route.name=='phone'?'active':''">电话配置</router-link>
						<router-link to="/phone" v-if="$route.name!='phone' && permissions.indexOf(285)  != -1"
							:class="$route.name=='phone'?'active':''">电话配置
						</router-link>
						<router-link to="/params" v-if="$route.name=='params' && permissions.indexOf(289)  != -1"
							@click.native="flushCom" :class="$route.name=='params'?'active':''">参数设置</router-link>
						<router-link to="/params" v-if="$route.name!='params' && permissions.indexOf(289)  != -1"
							:class="$route.name=='params'?'active':''">参数设置
						</router-link>
						<router-link to="/account" v-if="$route.name=='account' && permissions.indexOf(292)  != -1"
							@click.native="flushCom" :class="$route.name=='account'?'active':''">账号安全</router-link>
						<router-link to="/account" v-if="$route.name!='account' && permissions.indexOf(292)  != -1"
							:class="$route.name=='account'?'active':''">账号安全
						</router-link>
					</div>
				</li>
			</ul>
			<!-- ------------------------- -->


		</div>

		<div class="rightCont">
			<router-view>
			</router-view>
		</div>

	</div>
</template>
<script type="text/babel">
	export default {
		name: "",
		data() {
			return {
				down1: true,
				down2: true,
				permissions:[],
				uname :sessionStorage.getItem('userName')
			};
		},
		components: {},

		created() {},

		mounted() {
			// var n = 10
			// var url = ''
			var that = this
			// console.log(that.$permissions)
			that.permissions = that.$permissions
			// setTimeout(function(){
				// that.permissions = that.$permissions
				// if(that.permissions.indexOf(56)  == -1 &&that.permissions.indexOf(58)  == -1 &&that.permissions.indexOf(60)  == -1){
				// 	sessionStorage.setItem("rou",7)
				// 	url = '/department'
				// 	if(that.uname == 'admin'){
				// 		url = '/setting'
				// 	}
				// }
				
				// console.log(that.$permissions)
				// if(that.permissions.indexOf(70) != -1){
				// 	url = '/department'
				// }else if(that.permissions.indexOf(73) != -1){
				// 	url = '/userlist'
				// }else if(that.permissions.indexOf(76) != -1){
				// 	url = '/group'
				// }else if(that.permissions.indexOf(79) != -1){
				// 	url = '/engineer'
				// }else if(that.permissions.indexOf(93) != -1){
				// 	url = '/permissions'
				// }else if(that.uname == 'admin'){
				// 	url = '/setting'
				// }else{
				// 	console.log('log111')
				// 	sessionStorage.setItem("rou",8)
				// 	url = '/log'
				// }
				
				// that.$router.push(url); 
				
				
				
			// },100)
		},

		methods: {
flushCom:function(){
// 　　　　　　this.$router.go(0);  

　　　　}
		},

		computed: {},
	};
</script>
<style lang='less' scoped>
	li {
		background: #fff;
		position: relative;
		z-index: 2;

	}

	.rightCont {
		position: relative;
	}

	.icon-up {
		transition: all .3s;
	}

	.down {
		transition: all .3s;
	}
</style>
